<?php
  define('QTY',1000);
  define('COLS',5);
  $rows = ceil( QTY / COLS );
  $count =1;

$t1 = microtime();
$m1 = memory_get_usage();
?>
<table align="center"  border="1" width="80%">
  <thead>
    <tr>
      <th colspan="<?=COLS?>">Table Heading</th>
    </tr>
  </thead>

  <tbody>
<?php for($i=1 ; $i<=$rows ; $i++) {
      $color = $i % 2 == 0 ? 'yellow':'lightgreen';
?>
    <tr>
      <?php for ($j = 1; $j <= COLS ; $j++) {

        if($count <= QTY){
      ?>
        <td style="background:<?=$color?>"><?=$count++?></td>
      <?php } else {// end if()
      ?>
        <td style="background:<?=$color?>">&nbsp;</td>
      <?php
        }//end else
      }// end for for $j ?>
    </tr>
<?php }// end for for $i ?>
  </tbody>

</table>
<?php
echo "<br><br>";
echo microtime() - $t1;
echo "<br><br>";
echo memory_get_usage() - $m1;
